//
//  LGAdviceSendSuccesController.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/10/10.
//  医嘱发送成功

#import "LGAdviceSendSuccesController.h"
#import "LGFollowAdviceRecordController.h"
//要返回的上一级页面
//聊天
#import "TUIC2CChatViewController.h"
#import "TUIGroupChatViewController.h"
//最新病情概览
#import "LGDiseaseOverviewController.h"

@interface LGAdviceSendSuccesController ()

/**   */
@property (nonatomic , strong)UIButton *successBtn;
/**   */
@property (nonatomic , strong)UIButton *checkBtn;
/**   */
@property (nonatomic , strong)UIButton *backBtn2;

@end

@implementation LGAdviceSendSuccesController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationView.title = @"发送给患者";
    [self.view addSubview:self.successBtn];
    [self.view addSubview:self.checkBtn];
    [self.view addSubview:self.backBtn2];
}

//返回 -- 开具医嘱的上一页
-(void)backButtonAction{
    for (UIViewController *controller in self.navigationController.viewControllers) {
        //单聊
        if([controller isKindOfClass:[TUIC2CChatViewController class]]){
            [self.navigationController popToViewController:controller animated:YES];
            return;
        }
        //群聊
        if([controller isKindOfClass:[TUIGroupChatViewController class]]){
            [self.navigationController popToViewController:controller animated:YES];
            return;
        }
        
        //最新病情概览
        if([controller isKindOfClass:[LGDiseaseOverviewController class]]){
            [self.navigationController popToViewController:controller animated:YES];
            return;
        }
    }
    [self.navigationController popViewControllerAnimated:YES];
}

//查看医嘱详情 --  随访和医嘱记录页面
-(void)checkBtnAction{
    UIViewController *backVC = self;
    for (UIViewController *controller in self.navigationController.viewControllers) {
        //单聊
        if([controller isKindOfClass:[TUIC2CChatViewController class]]){
            backVC = controller;
            break;
        }
        //群聊
        if([controller isKindOfClass:[TUIGroupChatViewController class]]){
            backVC = controller;
            break;
        }
        //最新病情概览
        if([controller isKindOfClass:[LGDiseaseOverviewController class]]){
            backVC = controller;
            break;
        }
    }
    LGFollowAdviceRecordController *controller = [[LGFollowAdviceRecordController alloc]init];
    controller.patientid = self.patientid;
    controller.backVC = backVC;
    [self.navigationController pushViewController:controller animated:YES];
}

-(UIButton *)successBtn{
    if(!_successBtn){
        _successBtn = [UIButton buttonWithTitle:@"发送成功" titleFont:LGFontWeight(18, UIFontWeightSemibold) textColor:@"#4C87FD" imageName:@"医嘱发送成功"];
        _successBtn.frame = CGRectMake((Screen_W-viewPix(120))/2.0, topBarHeight+viewPix(100), viewPix(120), viewPix(150));
        [_successBtn setButtonInsetsStyle:LGButtonInsetsStyleTop marginSpace:5];
        _successBtn.userInteractionEnabled = NO;
    }
    return _successBtn;
}

-(UIButton *)checkBtn{
    if(!_checkBtn){
        _checkBtn = [UIButton buttonWithTitle:@"查看医嘱详情" titleFont:LGFontWeight(16, UIFontWeightMedium) textColor:@"#429BFF" imageName:@""];
        _checkBtn.frame = CGRectMake(viewPix(47), kMaxY(self.successBtn.frame)+viewPix(20), (Screen_W-viewPix(118))/2.0, viewPix(46));
        _checkBtn.layer.borderColor = [UIColor colorWithString:@"#429BFF"].CGColor;
        _checkBtn.layer.borderWidth = 1;
        _checkBtn.cornerRidus = 10;
        [_checkBtn addTarget:self action:@selector(checkBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _checkBtn;
}

-(UIButton *)backBtn2{
    if(!_backBtn2){
        _backBtn2 = [UIButton buttonWithTitle:@"返回" titleFont:LGFontWeight(16, UIFontWeightMedium) textColor:@"#FFFFFF" imageName:@""];
        _backBtn2.frame = CGRectMake(viewPix(24)+kMaxX(self.checkBtn.frame), kMaxY(self.successBtn.frame)+viewPix(20), (Screen_W-viewPix(118))/2.0, viewPix(46));
        _backBtn2.backgroundColor = [UIColor colorWithString:@"#429BFF"];
        _backBtn2.cornerRidus = 10;
        [_backBtn2 addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _backBtn2;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
